/*
2.两个字符串，第二个字符串是第一个的缺了几个，打印第二个字符串缺了的字符位置。
“abc”, “ab” => print  “2”
“abc”, “b” => print “0 2”
“abc”, “ac” => print “1”
“aab”, “ab” =>  print “0”   OR   print “1”
*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

vector<int> findMissing(const string &src, const string &tar)
{
    char hash[256] = {0};
    vector<int> pos;
    for (int i = 0; i < tar.size(); i++)
	hash[tar[i]]++;

    for (int i = 0; i < src.size(); i++) {
	if (hash[src[i]] == 0) pos.push_back(i);
	else hash[src[i]]--;
    }

    return pos;
}

int main(int argc, char **argv)
{
    vector<int> ans;
    ans = findMissing("abc", "ab");
    for (int i = 0; i < ans.size(); i++)
	cout << ans[i] << " ";
    cout << endl;

    ans = findMissing("abc", "b");
    for (int i = 0; i < ans.size(); i++)
	cout << ans[i] << " ";
    cout << endl;

    ans = findMissing("abc", "ac");
    for (int i = 0; i < ans.size(); i++)
	cout << ans[i] << " ";
    cout << endl;

    ans = findMissing("aab", "ab");
    for (int i = 0; i < ans.size(); i++)
	cout << ans[i] << " ";
    cout << endl;
}
